home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / PlasmaBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  5KB  |  147 lines

  1. package symantec.itools.multimedia;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/19/98    LAB    Moved to GroupAWTMultimedia folder.
  8.  
  9. /**
  10.  * BeanInfo for Plasma.
  11.  *
  12.  */
  13.  
  14. public class PlasmaBeanInfo extends SimpleBeanInfo {
  15.  
  16.     /**
  17.      * Constructs a PlasmaBeanInfo object.
  18.      */
  19.     public PlasmaBeanInfo() {
  20.     }
  21.  
  22.     /**
  23.      * Gets a BeanInfo for the superclass of this bean.
  24.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  25.      */
  26.     public BeanInfo[] getAdditionalBeanInfo() {
  27.         try {
  28.             BeanInfo[] bi = new BeanInfo[1];
  29.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  30.             return bi;
  31.         }
  32.         catch (IntrospectionException e) { throw new Error(e.toString());}
  33.     }
  34.  
  35.     /**
  36.      * Gets the SymantecBeanDescriptor for this bean.
  37.      * @return an object of type SymantecBeanDescriptor
  38.      * @see symantec.itools.beans.SymantecBeanDescriptor
  39.      */
  40.     public BeanDescriptor getBeanDescriptor() {
  41.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  42.         String s=group.getString("GroupAWTMultimedia"); 
  43.  
  44.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  45.         bd.setFolder(s);
  46.         bd.setToolbar(s);
  47.         bd.setWinHelp("0x1239B");
  48.  
  49.         return (BeanDescriptor) bd;
  50.     }
  51.  
  52.     /**
  53.      * Gets an image that may be used to visually represent this bean
  54.      * (in the toolbar, on a form, etc).
  55.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  56.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  57.      * @return an image for this bean, always color even if requested monochrome
  58.      * @see BeanInfo#ICON_MONO_16x16
  59.      * @see BeanInfo#ICON_COLOR_16x16
  60.      * @see BeanInfo#ICON_MONO_32x32
  61.      * @see BeanInfo#ICON_COLOR_32x32
  62.      */
  63.     public java.awt.Image getIcon(int iconKind) {
  64.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  65.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  66.             java.awt.Image img = loadImage("PlasmaC16.gif");
  67.             return img;
  68.         }
  69.  
  70.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  71.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  72.             java.awt.Image img = loadImage("PlasmaC32.gif");
  73.             return img;
  74.         }
  75.  
  76.         return null;
  77.     }
  78.  
  79.     /**
  80.      * Gets an array of descriptions of the methods used for "connections" by
  81.      * Visual CafΘ's Interaction Wizard.
  82.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  83.      * @return method descriptions for this bean
  84.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  85.      */
  86.     public MethodDescriptor[] getMethodDescriptors() {
  87.         Class[] args;
  88.         ConnectionDescriptor connection;
  89.         java.util.Vector connections;
  90.         java.util.Vector md = new java.util.Vector();
  91.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  92.  
  93.         try{
  94.             args = null;
  95.             MethodDescriptor startPlasma = new MethodDescriptor(beanClass.getMethod("startPlasma", args));
  96.  
  97.             connections = new java.util.Vector();
  98.             connection = new ConnectionDescriptor("input", "void", "",
  99.                                     "%name%.startPlasma();",
  100.                                     conn.getString("startPlasma"));
  101.             connections.addElement(connection);
  102.  
  103.             startPlasma.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  104.             md.addElement(startPlasma);
  105.         } catch (Exception e) { throw new Error("startPlasma:: " + e.toString()); }
  106.  
  107.         try{
  108.             args = null;
  109.             MethodDescriptor stopPlasma = new MethodDescriptor(beanClass.getMethod("stopPlasma", args));
  110.  
  111.             connections = new java.util.Vector();
  112.             connection = new ConnectionDescriptor("input", "void", "",
  113.                                     "%name%.stopPlasma();",
  114.                                     conn.getString("stopPlasma"));
  115.             connections.addElement(connection);
  116.  
  117.             stopPlasma.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  118.             md.addElement(stopPlasma);
  119.         } catch (Exception e) { throw new Error("stopPlasma:: " + e.toString()); }
  120.  
  121.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  122.         md.copyInto(rv);
  123.  
  124.         return rv;
  125.     }
  126.  
  127.     /**
  128.      * Returns descriptions of this bean's properties.
  129.      */
  130.     public PropertyDescriptor[] getPropertyDescriptors() {
  131.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  132.  
  133.         try{
  134.         PropertyDescriptor previewMode = new PropertyDescriptor("previewMode", beanClass);
  135.         previewMode.setBound(true);
  136.         previewMode.setConstrained(false);
  137.         previewMode.setDisplayName(prop.getString("previewMode"));
  138.  
  139.         PropertyDescriptor[] rv = {
  140.             previewMode};
  141.         return rv;
  142.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  143.     }
  144.  
  145.     private final static Class beanClass = Plasma.class;
  146.  
  147.     }    //  end of class PlasmaBeanInfo